package team.hyznrj.studentsys.utils;

import org.springframework.stereotype.Component;
import team.hyznrj.studentsys.dto.ResultDto;

/**
 * @author ReMidDream
 * @date 2018-02-22 15:55
 **/
public class ResultUtil {

    public static ResultDto Success(Object object){
        ResultDto resultDto = new ResultDto();
        resultDto.setData(object);
        resultDto.setMsg("成功");
        resultDto.setCode(0);
        return resultDto;
    }

    public static ResultDto Success(){
        return Success(null);
    }

    public static ResultDto Error(Integer code, String msg){
        ResultDto resultDto = new ResultDto();
        resultDto.setMsg(msg);
        resultDto.setCode(code);
        return resultDto;
    }
}
